<?php


namespace Xy\Rbac\Controllers;


use Illuminate\Routing\Controller;
use Xy\Rbac\Services\RbacUserService;

class RbacUserController extends Controller {
    
    protected $_rbacUserService;
    
    public function __construct(RbacUserService $rbacUserService) {
        $this->_rbacUserService = $rbacUserService;
    }
    
    /**
     * @return array
     */
    public function getPage() {
        return $this->_rbacUserService->getRabcUserPage();
    }
    
    /**
     * @param int $id
     *
     * @return \Illuminate\Support\Collection
     */
    public function getUserRoleIdList(int $id) {
        return $this->_rbacUserService->getUserRoleIdList($id);
    }
    
    /**
     * @param $id
     *
     * @return \Illuminate\Support\Collection
     */
    public function assignRole($id) {
        return $this->_rbacUserService->assignRole($id, request()->input('roles'));
    }
}